package com.digidata.ui

import java.awt.*
import groovy.swing.SwingBuilder
import java.awt.BorderLayout
import javax.swing.*

class SwingTest {

	public static void main(String[] args){
		
		SwingBuilder swing = new SwingBuilder()
		def frame = swing.frame(title:'Built with SwingBuilder', defaultCloseOperation:JFrame.EXIT_ON_CLOSE, pack:true, show:true){
			menuBar{
				//menu('File'){
					//menuItem('Exit'){exit()}
				//}
				menu('Help'){
					menuItem('About')
				}
			}
			panel{
				label('Select a color')
				colorChooser()
			}
		}
		
		frame.pack()
		frame.show()			
	
	
		def BL = new BorderLayout()
		
		def swing2 = new SwingBuilder()
		def	frame2 = swing2.frame(title:'Frame', size:[300,300], layout:new BorderLayout()) {
			scrollPane(constraints:BL.CENTER){
				textArea()
			}
			panel(constraints:BL.SOUTH){
				button(text:"Hello", actionPerformed:{println "Hello"})
			}
		}
		
		frame2.show()
	}
	
	public void exit(){
		System.exit(0)
	}
}